import Vue from 'vue'
import App from './App.vue'
// 引入路由
import router from './router'
import store from './store'

// 引入vant
import Vant from 'vant'
import './style/vant.less' //自定义vant样式

Vue.use(Vant) //vant实例
import '@/assets/iconfont/iconfont.css' //iconfont图标
import { Icon } from 'vant'

// import '@/utils/vant'
Vue.use(Icon)

// 自定义指令改变选中的颜色
Vue.directive('activeType',{
  inserted:(el)=>{
    el.addEventListener('click',function(){
      el.style.color !== 'rgb(33, 185, 122)' ?  el.style.color = 'rgb(33, 185, 122)' : el.style.color = '#333' 
    })
  }
})

// 引入封装的axios
import request from './utils/request'
Vue.directive('colorEvent', (el) => {
  el.addEventListener('click', () => {
    console.log(el);
    if (el.style.color === 'rgb(33, 185, 122)') {
      el.style.backgroundColor = '#fff'
      el.style.border = '1px solid #ddd'
      el.style.color = '#888'
    } else {
      el.style.backgroundColor = '#defaef'
      el.style.border = '1px solid #21b97a'
      el.style.color = '#21b97a'
    }
  })
})


Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: (h) => h(App),
}).$mount('#app')
